package com.renchunlin.taobaounion.utils;

import android.text.TextUtils;

public class UrlUtils {

    public static String createHomePagerUrl(int materialId, int page) {
        return "discovery/" + materialId + "/" + page;
    }

    public static String getCoverPath(String pict_url, int size) {
        return "https:" + pict_url + "_" + size + "x" + size + ".jpg";
    }

    public static String getCoverPath(String pict_url) {
        if (!TextUtils.isEmpty(pict_url)) {
            if (pict_url.startsWith("http") || pict_url.startsWith("https")) {
                return pict_url;
            } else {
                return "https:" + pict_url + "_" + 300 + "x" + 300 + ".jpg";
            }
        }
        return "";
    }

    public static String getTicket(String url) {
        if (!TextUtils.isEmpty(url)) {
            if (url.startsWith("http") || url.startsWith("https")) {
                return url;
            } else {
                return "https:" + url;
            }
        }
        return "";
    }

    public static String getSelectedPageContentUrl(int favorites_id) {
        return "recommend/" + favorites_id;
    }

    public static String getOnSellPageUrl(int currentPage) {
        return "onSell/" + currentPage;
    }
}
